package create.rpc.client;

import create.rpc.RpcClient;
import create.rpc.api.Hello2Service;
import create.rpc.api.HelloObject;
import create.rpc.api.HelloService;
import create.rpc.serializer.CommonSerializer;
import create.rpc.serializer.ProtobufSerializer;

public class NettyTestClient
{
    public static void main(String[] args) {

        RpcClient client = new NettyClient(CommonSerializer.PROTOBUF_SERIALIZER);
        RpcClientProxy rpcClientProxy = new RpcClientProxy(client);
        HelloService helloService = rpcClientProxy.getProxy(HelloService.class);
        HelloObject object = new HelloObject(12, "This is a message");
        String res = helloService.hello(object);

        Hello2Service proxy2 = rpcClientProxy.getProxy(Hello2Service.class);
        String msg = proxy2.saySomething("Hello everyOne");

        System.out.println(msg);

        System.out.println(res);

    }
}
